﻿using Core.Manage.User;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XStudio.WebFramework.Mvc.Filter;

namespace Admin.Areas.User.Controllers
{
    [AuthorizeFilter]
    [Description("用户管理")]
    public class StartController : Controller
    {
        [Description("首页")]
        public ActionResult Index()
        {
            return View();
        }

        [Description("删除帐号")]
        public ActionResult Delete(int id, int type)
        {
          var result=  AccountRule.Instance.Delete(id);

            if (type == 0)
            {
                FamerRule.Instance.Delete(t => t.AccountID == id);
            }
            if (type == 1)
            {
                GrainBuyerRule.Instance.Delete(t => t.AccountID == id);
            }
            if (type == 2)
            {
                ProductionGoodsRule.Instance.Delete(t => t.AccountID == id);
            }
            else if (type==3)
            {
                CooperativeRule.Instance.Delete(t => t.AccountID == id);
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }
    }
}